//定义 一个js对象
var loginManager1 = {};

//  给对象loginManager1.login 复制一个函数
loginManager1.login = function () {

    $.ajax({
        url:'/LoginServlet',
        type:'post',
        data:{
            "staffId":$("#staffId").val(),
            "password":$("#password").val()
        },
        dataType:'json',
        success:function (result) {
            if(result.status==1){
                alert("登陆成功");
                var data = result.data;
                window.location.href = "../index/views/main.html";
                window.localStorage.setItem("loginName",data.staffName);
                window.localStorage.setItem("staffId",data.staffId);
                window.localStorage.setItem("id",data.roleId);



                window.localStorage.setItem("phone",data.phone);
                window.localStorage.setItem("idCard",data.idCard);
                window.localStorage.setItem("address",data.address);
                window.localStorage.setItem("createdTime",data.createdTime);
                window.localStorage.setItem("password",data.password);
                window.localStorage.setItem("password",data.password);

                console.log("id",data.roleId);
            }else {
               alert("登陆失败");
            }
        }
    })
}